<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>
    <button id="jsError">js错误</button>
    <button id="promiseError">promise错误</button>
    <button id="resourceError">resource错误</button>

    <img src="../assets/logo.png" id="img1">
  </div>
</body>
<script src="index.js"></script>
<script>
  window.onload = function(){
    monitor.init({});

    const jsError = document.getElementById('jsError');
    const promiseError = document.getElementById('promiseError');
    const resourceError = document.getElementById('resourceError');
    const img1 = document.getElementById('img1');

    resourceError.addEventListener('click',function(){
      img1.setAttribute('src','../assets/logo1.png')
    })

    promiseError.addEventListener('click',function(){
      Promise.reject(Error('promise error'));
    })

    jsError.addEventListener('click', function jsErrorFn(){
      let str = null;
      console.log(str.length);
    })
  }
  
</script>
</html>
